package com.corona.game.util;

import java.util.ArrayList;

/* loaded from: pokewilds.jar:com/pkmngen/game/util/TextField.class */
public class TextField {
    private static final int ASCII_BACKSPACE = 0;
    private static final char[] SYMBOLS = {'.', ',', '-', 8217, '?', '!', '<', '>', ' '};

    public static boolean updateField(char character, ArrayList<Character> characters, int maxLength, boolean allowSymbols) {
        if (character == '\b' && characters.size() > 0) {
            characters.remove(characters.size() - 1);
            return true;
        } else if (characters.size() >= maxLength) {
            return false;
        } else {
            if ((character >= 'a' && character <= 'z') || ((character >= 'A' && character <= 'Z') || (character >= '0' && character <= '9'))) {
                characters.add(Character.valueOf(character));
                return true;
            } else if (!allowSymbols) {
                return false;
            } else {
                for (int i = 0; i < SYMBOLS.length; i++) {
                    if (character == SYMBOLS[i]) {
                        characters.add(Character.valueOf(character));
                        return true;
                    }
                }
                return false;
            }
        }
    }
}
